// 主题上下文的配置管理空间
import { useState, createContext } from 'react'

const ThemeContext = createContext('light') // 创建上下文，默认值为'light'

const ThemeProvider = ({ children }) => {
    const [theme, setTheme] = useState('light') // 主题状态
    const globalState = "globalState"
    const toggleTheme = () => setTheme(theme === 'light' ? 'dark' : 'light') // 切换主题

    return <ThemeContext.Provider value={{ theme, toggleTheme, globalState }}>
        {children}
    </ThemeContext.Provider>
}

export { ThemeContext, ThemeProvider }